The present invention relates generally to peripheral storage devices and, more particularly, to techniques for monitoring the transfer of data between a host system and a hard disk drive or other peripheral storage device.
Computer systems commonly include one or more peripheral storage devices that are used to store and/or provide access to data. One common type of peripheral storage device is a hard disk drive. Other types of peripheral storage devices include tape drives, CD drives (both read-only and read/write), and DVD devices.
The most basic parts of a hard disk drive include at least one platter or xe2x80x9cdiskxe2x80x9d that is rotated, an actuator that moves a transducer to various locations over the disk, and electrical circuitry that is used to write and read data to and from the disk. The disk drive also includes circuitry for encoding data so that data can be successfully retrieved from and written to the disk surface. The circuitry for encoding the data and circuitry that is used to perform the read and write operations on the disk are usually in a controller. The controller can be made as an integrated circuit placed within the hard disk drive. A disk drive microprocessor (xe2x80x9cmicroprocessorxe2x80x9d) can be either embedded within or external to the controller integrated circuit.
The microprocessor controls most of the operations of the disk drive by configuring and monitoring the operation of the controller. For example, a host computer can initiate an operation by sending the controller a read command. The microprocessor recognizes the command and sets up registers in the controller to perform the read operation. The data is then read from the disk into a buffer. When a minimum amount of data is in the buffer the microprocessor sets up the controller to send the data from the buffer to the host.
Data is commonly read from or written onto the hard disk using a parallel processing scheme. The parallel processing method allows the disk controller to simultaneously read data, check for errors, and correct errors. This parallel processing is sometimes referred to as pipelining. For example, while one sector is read by a module, a second sector can be error checked by another module, and a third sector can be corrected in a third module. It can be seen that, with a parallel writing and reading method, several different operations on different sectors can take place at the same time. If an error is detected by any of the operations, it can be difficult and time consuming to determine which sector generated the error condition. Algorithms and decision trees are sometimes used to track the propagation of sectors through the error detection units to determine which sector is operated on at any given time. The processing power required to keep track of the sectors in such a pipelining reading and writing scheme slows down the operation of the disk drive. Therefore it would be an advantage over prior disk drive systems to enable a disk drive to determine which data has been properly read or written without using complicated algorithms.
Certain unique problems are encountered when a disk drive system employs look ahead caching to speed up the transfer of data from the disk to the buffer. Look ahead caching is a method that uses the observation that once a sector is read it is likely that the sectors following it will also be read, since data is usually stored and read in sequential order. Therefore, when a request for a sector read is made, the look ahead cache will read additional sectors following the requested sector up to a certain number of sectors depending on the size of the cache. In this manner, requests for reading sectors that follow the first sector read will be processed by accessing the cache, thereby providing a shorter seek time for disk read operations. A complication arises when the disk controller receives a read request for a sector that is out of sequence with the earlier sectors. At this time, instead of transferring data from the cache, the data will have to be read from the physical media since the requested sector was not read into the cache. The microprocessor has to interrupt the reading of the sequential sectors into the cache and setup the controller to access the requested sector area on the physical media. If the next request following the out of order sector request is again within the sequence, the microprocessor commonly does not have any way of knowing whether the sector has been read into the cache. Instead of servicing the request from the cache, the microprocessor will have to set up the controller to access the data on the physical media to ensure data integrity. Therefore, it would be an improvement over prior systems for the microprocessor to be able to easily and rapidly determine how many sectors were properly read during an operation to prevent the microprocessor from reading the same sector twice.
The present invention overcomes the above problems by providing a tracking circuit that allows the microprocessor to efficiently monitor the number of successful sector transfers. The circuit is preferably incorporated within a disk drive controller. The circuit includes a counter that monitors the number of successful sector transfers during the present disk access. In a preferred embodiment, a successful transfer during a read operation is defined as a successful application of all error correction protocols for the sector, or data segment, transferred; and a successful transfer during a write operation is defined as the successful placement of a sector, or data segment, on the physical disk platter. The circuit also includes a programmable target register that can be programmed by the microprocessor with a target value for the number of sectors transferred. A comparator is used to compare the value from the counter to that in the target register. When the number of requested sector transfers has taken place, the comparator output is used to notify the processor that the target has been reached. The result of the comparison can be communicated to the microprocessor by, for example, an interrupt or a bit that is set in a microprocessor readable register. The microprocessor may additionally or alternatively be permitted to directly read the contents of the counter or write values to the counter.
The method of the present invention includes the steps of, on a disk access sequence, tracking successful transfers of sectors to the disk and to the buffer, incrementing a counter when a sector is successfully transferred, comparing the output of the counter to a value from a programmable register, and generating a result bit from the comparator.
The present invention provides the ability to track the number of completed sector transfers to ensure that the operation has completed successfully before the data can be further manipulated or extracted. The method of the present invention provides the advantage of allowing the microprocessor to efficiently determine, when an error condition arises, how many sectors have been read or written successfully, thereby eliminating the need to reinitiate the entire disk access sequence. The method of the present invention also enables the microprocessor to determine how many sectors were read into a look ahead cache, thereby providing for a better use of the cache.
In one embodiment, the present invention offers the additional advantage of allowing the microprocessor to read the output of the sector counter directly. Further, the microprocessor can also change the value in the target register once a target is reached to set a new target value. In the alternative, multiple programmable registers can be provided within the tracking circuit to allow the microprocessor to trace several points during the transfer of sectors. The present invention also increases data reliability by generating the successful sector read/write signal only once the data is actually available on the proper unit for reading or writing.
Although the invention is preferably embodied within a hard disk controller, it will be appreciated that the invention can be used within controllers of other types of peripheral storage devices, including tape drives, flash memory drives, and optical drives.